Skip to main content

Backup/Restore using PostgreSQL database

Backup File:

  1. Open command prompt and go to location of bin folder in pgsql. As shown in figure below:

    Docusaurus Slash Introduction

  • location: C:\aiv_postgreNOV2\pgsql\bin

  • aiv_postgreNOV2: name of installed aiv in local machine.

  1. Take backup using below command: pg_dump -U postgres -W -F t aiv > C:/AIV/backup.tar
  • postgres: stand for default username.

  • aiv: stand for default database name.

  • AIVHUB: stand for default password.

    Docusaurus Slash Introduction

  1. Insert postgreSQL password after adding the command, as shown in figure below:

    Docusaurus Slash Introduction

  2. As per 2nd point, the default password of PostgreSQL is “AIVHUB”. Add password and hit enter button. it will look as figure below:

    Docusaurus Slash Introduction

  3. Check the backup file at the specified location.

Restore backup file:

  1. open file location of postgres in command prompt, as shown in figure below:

    Docusaurus Slash Introduction

  2. Login to postgreSQL using command: psql –d [database name] –U [username]

    ![Docusaurus Slash Introduction](/aiv_img/usecase/BackupRestorePostgreSQL6.png)
  3. Insert Password, hit enter button. it will login into postgres as shown in figure below:

    Docusaurus Slash Introduction

Note: Default password: AIVHUB

  1. The password may not be visible while typing in command prompt. as shown in figure below:

    Docusaurus Slash Introduction

  2. After login, add command to create database as follows: Command line: create database postgre1;

    Docusaurus Slash Introduction

  3. The command prompt will show the CREATE DATABASE alert as shown in figure below:

    Docusaurus Slash Introduction

  4. To see the available list of databases in AIV, user needs to insert command as follows:

  • command: \list

  • Hit enter after adding command.

    Docusaurus Slash Introduction

  1. Now press “ctrl + z” to logout from postgres.

    Docusaurus Slash Introduction

  2. Now, add command to Restore the dump using command as follows: Command: psql -h localhost -p 6432 -U [Postgres username] -f "[C:\path location\filename.tar]" [database name] Example: psql -h localhost -p 6432 -U postgres -f "C:\backup\postbackup.tar" postgre1

  • 6432: Port number, the default number is 6432, it’s different from the below figure.

  • postgres: Default username of PostgreSQL

  • C:\backup\postbackup.tar: Example location of the dump file.

  • postgre1: Database name which is created by user.

    Docusaurus Slash Introduction